<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUserReportTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user_report', function (Blueprint $table) {
            $table->increments('id');
            $table->unsignedInteger('user_id')->comment('用户ID');
            $table->string('mobile')->comment('手机号');
            $table->unsignedInteger('total_recharge_amount')->default(0)->comment('充值总金额');
            $table->unsignedInteger('complete_recharge_amount')->default(0)->comment('已充值金额');
            $table->unsignedInteger('wait_recharge_amount')->default(0)->comment('待充值金额');
            $table->unsignedInteger('pay_total_amount')->default(0)->comment('实际支付金额');
            $table->unsignedInteger('order_num')->default(0)->comment('充值订单数');
            $table->dateTime('register_time')->comment('注册时间');
            $table->dateTime('first_recharge_time')->nullable()->comment('首充时间');
            $table->dateTime('retry_recharge_time')->nullable()->comment('复充时间');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('user_report');
    }
}
